package com.briup.demo.service;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.briup.demo.bean.XcdComment;
import com.briup.demo.mapper.XcdCommentMapper;

@Service
public class XcdCommentService {
	@Autowired
	private XcdCommentMapper commentMapper;
	
	public List<XcdComment> selectAll(){
		List<XcdComment> list = commentMapper.selectAll();
		if(list!=null) {
			return list;
		}
		return new ArrayList<XcdComment>();
	}
	
	public XcdComment selectById(String id) {
		return commentMapper.selectByPrimaryKey(id);
	}

	public int deleteById(String id) {
		return commentMapper.deleteByPrimaryKey(id);
	}

    public int deleteByIds(String[] ids) {
    	int count = 0;
    	for(String id:ids) {
    		int num = deleteById(id);
    		if(0!=num) {
    			count++;
    		}
    	}
    	return count;
    }

}
